package org.yang.order.food.controller;

import org.yang.order.food.common.Msg;
import org.yang.order.food.entity.FoodType;
import org.yang.order.food.service.FoodTypeService;
import org.springframework.web.bind.annotation.*;

import com.github.pagehelper.PageInfo;

import javax.annotation.Resource;
import java.util.List;

/**
 * 菜品类型控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2018/12/03
 */
@RestController
@RequestMapping("/foodType")
public class FoodTypeController {
    @Resource
    private FoodTypeService foodTypeService;

    @GetMapping("/getFoodTypes")
    public List<FoodType> getFoodTypes(FoodType foodType, Integer page, Integer limit){
        return foodTypeService.getFoodTypes(foodType);
    }
    @PostMapping("/addFoodType")
    public Msg addFoodType(@RequestBody FoodType foodType){
        return foodTypeService.addFoodType(foodType);
    }

    @PutMapping("/updateFoodType")
    public Msg updateFoodType(@RequestBody FoodType foodType){
        return foodTypeService.updateFoodType(foodType);
    }

    @DeleteMapping("/delFoodType")
    public Msg delFoodType(@RequestBody FoodType foodType){
        return foodTypeService.delFoodType(foodType);
    }

}
